Skip to content

Add TFLite Micro examples #8379

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Conversation

sanketwadekar
Copy link
Contributor

@sanketwadekar sanketwadekar commented Jul 3, 2023

Description of Change

Added TFLite Micro examples.

Depends on espressif/esp32-arduino-lib-builder#128

Tests scenarios

I have tested these examples on ESP-EYE.

cc:@vikramdattu

@VojtechBartoska VojtechBartoska added the Type: Example Issue is related to specific example. label Jul 3, 2023
Copy link

@vikramdattu vikramdattu left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

@sanketwadekar thanks for adding the Arduino library. Couple of comments, and it should be good to go.

@@ -0,0 +1,10 @@
/*
* SPDX-FileCopyrightText: 2022 Espressif Systems (Shanghai) CO LTD

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Please update the license year to 2023 wherever applicable.

#include <utility>
/*
The example sketches include "tensorflow/lite/micro/micro_interpreter.h" which internally include "utility.h" header file when compiling examples for Arduino (when -DARDUINO flag is passed to the compiler). This header file does not exist in esp32-arduino core. Hence, keeping this file here as a workaround and including an alternate header file.
*/

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

add a new line, do check for other files as well.

-128, -128, -128, -128, -128, -128, -128, -128, -128, -128, -128, -128,
-128, -128, -128, -128, -128, -128, -128, -128, -128, -128, -128, -128,
-128, -128, -128, -128, -128, -128, -128, -128, -128, -128, -128, -128,
-128, -128, -128, -128,

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Although these files are present in original sources, these are not used here. Please remove these.


#include "no_micro_features_data.h"

// Golden test values for the expected spectrogram from a "no" sample file

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Please remove this file as well. Not used anymore.

@sanketwadekar sanketwadekar force-pushed the examples/tflite-micro branch from bee99c1 to 876bfd9 Compare July 3, 2023 08:00
@me-no-dev
Copy link
Member

please target the esp-idf-v5.1-libs branch instead.

@P-R-O-C-H-Y P-R-O-C-H-Y changed the base branch from master to esp-idf-v5.1-libs July 10, 2023 12:52
@P-R-O-C-H-Y
Copy link
Member

@sanketwadekar CI is failing:

arduino-esp32/libraries/TFLiteMicro/examples/hello_world/hello_world.ino:17:10: fatal error: tensorflow/lite/micro/micro_mutable_op_resolver.h: No such file or directory
 #include "tensorflow/lite/micro/micro_mutable_op_resolver.h"
          ^~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~

@sanketwadekar
Copy link
Contributor Author

@sanketwadekar CI is failing:

arduino-esp32/libraries/TFLiteMicro/examples/hello_world/hello_world.ino:17:10: fatal error: tensorflow/lite/micro/micro_mutable_op_resolver.h: No such file or directory
 #include "tensorflow/lite/micro/micro_mutable_op_resolver.h"
          ^~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~

This file is not yet present in esp32-arduino. It will be copied by the lib-builder.

@me-no-dev me-no-dev added this to the 3.0.0 milestone Jul 20, 2023
@me-no-dev
Copy link
Member

@sanketwadekar please pull the latest changes from the target branch. TFLite is merged and we can see if CI will pass

@vikramdattu
Copy link

@sanketwadekar please pull the latest changes from the target branch. TFLite is merged and we can see if CI will pass

@me-no-dev this will require lib-builder release to happen first, right?

@me-no-dev
Copy link
Member

@me-no-dev this will require lib-builder release to happen first, right?

Starting with IDF-v5.1 we build and get the libs in a different way. I have already added TFLite to the libs for 5.1 and have updated the branch. @sanketwadekar needs to pull all changes from that branch and that will trigger CI to re-run the tests with TFLite available.

Copy link
Collaborator

@lucasssvaz lucasssvaz left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Works as expected on ESP32-DevKitC

@VojtechBartoska VojtechBartoska added the Status: Pending Merge Pull Request is ready to be merged label Aug 30, 2023
@me-no-dev
Copy link
Member

Closing in favor of: #8717

@me-no-dev me-no-dev closed this Oct 5, 2023
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
Status: Pending Merge Pull Request is ready to be merged Type: Example Issue is related to specific example.
Projects
Development

Successfully merging this pull request may close these issues.

6 participants